package com.toobigtofail.utility
{
	import Box2D.Common.Math.b2Vec2;

	public class Util
	{
		public static function isSameVec(p1:b2Vec2, p2:b2Vec2):Boolean {
			return p1.x == p2.x && p1.y == p2.y;
		}
		
		public static function inRect(p:b2Vec2, rp:b2Vec2, width:uint, height:uint):Boolean {
			return p.x >= rp.x && p.x <= rp.x + width &&
				   p.y >= rp.y && p.y <= rp.y + height;
		}
		
		public static function random(low:int, high:int):int {
			return Math.floor(Math.random()*(1+high-low)+low);
		}
		
		public static function isWithin(p:b2Vec2, n:Number):Boolean {
			return (Math.sqrt(p.x*p.x + p.y*p.y) < n); 
		}
	}
}